Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

fix: improve MessageV0.getAccountKeys API ergonomics #28042

Merged
merged 1 commit into from
Sep 24, 2022

Conversation

jstarry
Copy link
Contributor

@jstarry jstarry commented Sep 24, 2022

Problem

The ergonomics of MessageV0.getAcccountKeys isn't great when writing code that can handle legacy or v0 messages:

const accountKeysFromLookups = txWithMeta.meta?.loadedAddresses;
const accountKeys = message.getAccountKeys(accountKeysFromLookups && {
  accountKeysFromLookups,
});

Summary of Changes

Allow args in GetAccountKeysArgs to be undefined or null for improved ergonomics:

const accountKeys = message.getAccountKeys({
  accountKeysFromLookups: txWithMeta.meta?.loadedAddresses,
});

Fixes #

@jstarry jstarry added the automerge Merge this Pull Request automatically once CI passes label Sep 24, 2022
@codecov
Copy link

codecov bot commented Sep 24, 2022

Codecov Report

Merging #28042 (4ff5186) into master (e6687b8) will increase coverage by 0.3%.
The diff coverage is 97.0%.

@@            Coverage Diff            @@
##           master   #28042     +/-   ##
=========================================
+ Coverage    77.3%    77.6%   +0.3%     
=========================================
  Files          55       55             
  Lines        2889     2918     +29     
  Branches      402      406      +4     
=========================================
+ Hits         2234     2267     +33     
+ Misses        514      510      -4     
  Partials      141      141             

@mergify mergify bot merged commit 7810387 into solana-labs:master Sep 24, 2022
@jstarry jstarry deleted the web3/get-account-keys-dev-x branch September 24, 2022 05:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge Merge this Pull Request automatically once CI passes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant